package com.guaoran.interview.spring.controller;

import com.guaoran.interview.spring.event.EmailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Collections;

/**
 * @author : 孤傲然
 * @description : 发送邮件， 进黑名单时，事件通知
 * @date :2020/1/2 14:04
 */
@RestController
public class EmailController {
    @Autowired
    private EmailService emailService;

    @GetMapping("/event")
    public String sendEmail(){
        emailService.setBlackList(Collections.singletonList("127.0.0.1"));
        emailService.sendEmail("127.0.0.1","hello event");
        return "event";
    }
}
